
package es.udc.emarketapp.emarket.model.categoryFacade.actions;


import es.udc.emarketapp.emarket.model.category.dao.SQLCategoryDAO;
import es.udc.emarketapp.emarket.model.category.dao.SQLCategoryDAOFactory;
import es.udc.fbellas.j2ee.util.exceptions.InstanceNotFoundException;
import java.sql.Connection;

import es.udc.fbellas.j2ee.util.exceptions.InternalErrorException;
import es.udc.fbellas.j2ee.util.sql.NonTransactionalPlainAction;


public class FindCategoryByIdAction implements NonTransactionalPlainAction {

    private Long idCat;

    public FindCategoryByIdAction(Long idCat) {
        this.idCat = idCat;
    }


    public Object execute(Connection connection)
        throws InstanceNotFoundException, InternalErrorException {

        SQLCategoryDAO categoryDAO = SQLCategoryDAOFactory.getDAO();

        return categoryDAO.findById(connection, idCat);

    }


}
